

restore,'./emaf_paper/bgps_emaf_potential.sav',/ver
oemaf = emaf

restore,'./emaf_paper/bgps_emaf.sav',/ver

thick = 5
bin   = 0.025

;;=======================================================
;; 1st Plot: Retained as a function of contrast

myps,'./emaf_paper/plots/selection_plots.eps'

plothist,oemaf.c,charsize=1.0,xtit='Contrast',color='Opposite',thick=thick,$
         bin=bin,yst=8,xmargin=[10,10],ox,oy,$
         ytit='N per '+cgsymbol('Delta')+'C='+string(bin,format="(F0.3)")+' bin'
plothist,emaf.c,/over,color='Firebrick',thick=thick,bin=bin,ex,ey

yr = !y.crange
axis,yaxis=1,yr=yr/100.,/save,ytit='Fraction Retained',/yst

cgoplot,ex,float(ey)/float(oy),color='ygb4',psym=4,thick=thick

vline,0.05,thick=thick,color=cgColor('tg3')
vline,/h,1.,color=cgColor('ygb4')

al_legend,box=0,/top,/right,color=['opposite','firebrick','ygb4'],linestyle=0,$
          ['All within L-V space and C '+cgsymbol('geq')+' 0.01','Final',$
           'Fraction'],thick=thick

ind = where(emaf.c LT 0.05,nlt)
print,'Number at C < 0.05: ',nlt

myps,/done


;;=======================================================
;; 2nd Plot: Retained as a function of I_MIR

myps,'./emaf_paper/plots/selection_plots2.eps'

thick = 5
bin   = 5

plothist,oemaf.i_mir,charsize=1.0,xtit='I!dMIR!n [MJy sr!u-1!n]',$
         color='Opposite',thick=thick,bin=bin,yst=8,xmargin=[10,10],ox,oy,$
         ytit='N per '+string(bin,format="(I0)")+' MJy sr!u-1!n bin'
plothist,emaf.i_mir,/over,color='Firebrick',thick=thick,bin=bin,ex,ey

yr = !y.crange/100.
axis,yaxis=1,yr=yr,/save,ytit='Fraction Retained',/yst

cgoplot,ex,float(ey)/float(oy),color='ygb4',psym=4,thick=thick

al_legend,box=0,/top,/right,color=['opposite','firebrick','ygb4'],linestyle=0,$
          ['All within L-V space and C '+cgsymbol('geq')+' 0.01','Final',$
           'Fraction'],thick=thick

cut = 90.
vline,cut,thick=thick,color=cgColor('tg3')
vline,/h,1.,color=cgColor('ygb4')

ind = where(emaf.i_mir GT cut,nlt)
print,'Number at I_MIR > '+string(cut,format="(I0)")+': ',nlt

myps,/done


;;=======================================================
;; 3rd Plot: C vs I_MIR vs S_1.1

myps,'./emaf_paper/plots/selection_plots3.eps',xsize=9

thick = 5
bin   = 5

multiplot,[2,1]

plot,emaf.c,emaf.i_mir,psym=cgSymcat(16),symsize=0.4,xtit='Contrast',$
     ytit='I!dMIR!n [MJy sr!u-1!n]',/nodata


vline,0.05,thick=thick,color=cgColor('tg3')
vline,90.,thick=thick,color=cgColor('tg3'),/h

oplot,emaf.c,emaf.i_mir,psym=cgSymcat(16),symsize=0.4
ind = where(emaf.c LT 0.05,nlt)
IF nlt GT 0 THEN $
   cgOplot,emaf[ind].c,emaf[ind].i_mir,psym=16,symsize=0.4,color='Deep Pink'

multiplot

print,m4_stat(emaf.s40)

plot,emaf.s40,emaf.i_mir,psym=cgSymcat(16),symsize=0.4,/xlog,$
     xtit='BGPS 40" Flux Density [Jy beam!u-1!n]',/nodata,xr=[0.06,10],/xst

vline,90.,thick=thick,color=cgColor('tg3'),/h,/xlog

oplot,emaf.s40,emaf.i_mir,psym=cgSymcat(16),symsize=0.4
ind = where(emaf.c LT 0.05,nlt)
IF nlt GT 0 THEN $
   cgOplot,emaf[ind].s40,emaf[ind].i_mir,psym=16,symsize=0.4,color='Deep Pink'

myps,/done,/mp

END
